<?php
class Usuarios_Form_Contrasena extends Form_Cna {
	
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		
		//Crea el formulario para el registro de usuarios del sistema
		$this->setName ( 'contrasena' );
		$this->setMethod("POST");
		
		$nombres = new Zend_Form_Element_Text ( 'nombreusuario' );
		$nombres->setLabel ( 'Usuario : ' );
		$nombres->setAttribs(array('size'=>30));
		$nombres->setRequired ( true );
		$nombres->addFilter ( 'StripTags' );
		$nombres->addFilter ( 'StringTrim' );
		$array_elements[]=$nombres;
				               
		$emailexterno = new Zend_Form_Element_Text ( 'emailexterno' );
		$emailexterno->setLabel ( 'Email : ' );
		$emailexterno->setAttribs(array('size'=>30));
		$emailexterno->setRequired ( true );
		$emailexterno->addFilter ( 'StripTags' );
		$emailexterno->addFilter ( 'StringTrim' );
		$emailexterno->addValidator ( 'EmailAddress');
		$array_elements[]=$emailexterno;

		$baseUrl = Zend_Controller_Front::getInstance ()->getBaseUrl()."/captcha";
		$ruta_archivos = APPLICATION_PATH."/../cna/captcha";
		$ruta_fonts = APPLICATION_PATH."/../cna/fonts/Arial.ttf";

        $captcha = new Zend_Form_Element_Captcha('imgvalidation', array(
            'label' => "Digite los caracteres que se visualizan en la imagen",
            'captcha' => 'Image',
            'captchaOptions' => array(
            'captcha' => 'Image',
            'wordLen' => 6,
            'timeout' => 300,
            'imgDir' => $ruta_archivos, // This folder has to have 777 permissions.
            'imgUrl' => $baseUrl,
            'width' => 200,
            'height' => 60,
            'font' => $ruta_fonts
            ),
        ));
        $captcha->setRequired ( true );
        $array_elements[]= $captcha;

		$submit = new Zend_Form_Element_Submit ( 'btnSubmit' );
		$submit->setValue('Guardar');
		$submit->setLabel("Guardar");
		$submit->setAttrib("class", "iceCmdBtn");
		$array_elements[]=$submit;
		
		$this->addElements ($array_elements);
		
		$this->loadViewScriptDecorators();
//        $this->loadTableDecorato$ruta_archivos$ruta_archivosrs();
	}
	
	public function loadViewScriptDecorators() {
		//$this->setDecorators ( array (array ('viewScript', array ('viewScript' => 'viewscripts/registro_form.phtml' ) ) ) );
	}

}